Attribute VB_Name = "modMxDisplaySettings"
Option Explicit

Public MxDevice As MiniX_Constant

'holds Mini-X Fixed Constant values for Display Setup
Public Type MiniX_Constant
    lTubeTypeID As Long                               ' Tube Type Identifier Index
    dblHighVoltageConversionFactor As Double          ' High Voltage Conversion Factor
    dblHighVoltageMin As Double                       ' High Voltage Min
    dblHighVoltageMax As Double                       ' High Voltage Max
    dblDefaultdblHighVoltage As Double                ' Default High Voltage kV
    dblCurrentMin As Double                           ' Current Min
    dblCurrentMax As Double                           ' Current Max
    dblDefaultCurrent As Double                       ' Default Current
    dblWattageMax As Double                           ' Wattage Max
    strTubeType As String                             ' Tube Type Name
    strControllerType As String                       ' Controller Type Name
    strCtrlTypeID As String                           ' Controller Type Short Name
End Type

Public Sub ReadMiniXSetup50kv4W(ByRef MiniXConstant As MiniX_Constant)
    MiniXConstant.strTubeType = "Mini-X2 50kV 4W"             ' Tube Type Name
    MiniXConstant.lTubeTypeID = 1                                ' Tube Type Identifier Index
    MiniXConstant.strControllerType = "Mini-X2 Controller"      ' Controller Type Name
    MiniXConstant.strCtrlTypeID = "Mini-X2"                         ' Controller Type Short Name
    MiniXConstant.dblHighVoltageConversionFactor = 12.5          ' High Voltage Conversion Factor
    MiniXConstant.dblHighVoltageMin = 10#                        ' High Voltage Min
    MiniXConstant.dblHighVoltageMax = 50#                        ' High Voltage Max
    MiniXConstant.dblDefaultdblHighVoltage = 15#                 ' Default High Voltage kV
    MiniXConstant.dblCurrentMin = 5#                             ' Current Min
    MiniXConstant.dblCurrentMax = 200#                           ' Current Max
    MiniXConstant.dblDefaultCurrent = 15#                        ' Default Current
    MiniXConstant.dblWattageMax = 4#                             ' Wattage Max
End Sub

Public Sub ReadMiniXSetup50kv10W(ByRef MiniXConstant As MiniX_Constant)
    MiniXConstant.strTubeType = "Mini-X2 50kV 10W"            ' Tube Type Name
    MiniXConstant.lTubeTypeID = 2                                ' Tube Type Identifier Index
    MiniXConstant.strControllerType = "Mini-X2 Controller"   ' Controller Type Name
    MiniXConstant.strCtrlTypeID = "Mini-X2"                      ' Controller Type Short Name
    MiniXConstant.dblHighVoltageConversionFactor = 12.5          ' High Voltage Conversion Factor
    MiniXConstant.dblHighVoltageMin = 10#                        ' High Voltage Min
    MiniXConstant.dblHighVoltageMax = 50#                        ' High Voltage Max
    MiniXConstant.dblDefaultdblHighVoltage = 15#                 ' Default High Voltage kV
    MiniXConstant.dblCurrentMin = 5#                             ' Current Min
    MiniXConstant.dblCurrentMax = 200#                           ' Current Max
    MiniXConstant.dblDefaultCurrent = 15#                        ' Default Current
    MiniXConstant.dblWattageMax = 10#                            ' Wattage Max
End Sub

Public Sub ReadMiniXSetup70kv10W(ByRef MiniXConstant As MiniX_Constant)
    MiniXConstant.strTubeType = "Mini-X2 70kV 10W"            ' Tube Type Name
    MiniXConstant.lTubeTypeID = 0                                ' Tube Type Identifier Index
    MiniXConstant.strControllerType = "Mini-X2 Controller"      ' Controller Type Name
    MiniXConstant.strCtrlTypeID = "Mini-X2"                         ' Controller Type Short Name
    MiniXConstant.dblHighVoltageConversionFactor = 20#           ' High Voltage Conversion Factor
    MiniXConstant.dblHighVoltageMin = 35#                        ' High Voltage Min
    MiniXConstant.dblHighVoltageMax = 70#                        ' High Voltage Max
    MiniXConstant.dblDefaultdblHighVoltage = 45#                 ' Default High Voltage kV
    MiniXConstant.dblCurrentMin = 10#                            ' Current Min
    MiniXConstant.dblCurrentMax = 143#                           ' Current Max
    MiniXConstant.dblDefaultCurrent = 15#                        ' Default Current
    MiniXConstant.dblWattageMax = 10#                            ' Wattage Max
End Sub

Public Sub ReadMiniXSetupDisplay(MxForm As Form, MiniXConstant As MiniX_Constant)
    Dim cstrVal As String

    cstrVal = MxDblDispFormat(MiniXConstant.dblHighVoltageMin)
    MxForm.lblMIN(1).Caption = cstrVal

    cstrVal = MxDblDispFormat(MiniXConstant.dblHighVoltageMax)
    MxForm.lblMAX(1).Caption = cstrVal
    
    cstrVal = MxDblDispFormat(MiniXConstant.dblDefaultdblHighVoltage)
    MxForm.txtHv.Text = cstrVal
    
    cstrVal = MxDblDispFormat(MiniXConstant.dblCurrentMin)
    MxForm.lblMIN(2).Caption = cstrVal
    
    cstrVal = MxDblDispFormat(MiniXConstant.dblCurrentMax)
    MxForm.lblMAX(2).Caption = cstrVal
    
    cstrVal = MxDblDispFormat(MiniXConstant.dblDefaultCurrent)
    MxForm.txtCurrent.Text = cstrVal

End Sub

Public Function MxDblDispFormat(dblValue As Double) As String
    Dim strDisplay As String
    strDisplay = Format(dblValue, "0")
    MxDblDispFormat = strDisplay
End Function











